import xlwt

# 创建book,并设定编码
workbook = xlwt.Workbook(encoding='ASCII')

#创建新的sheet表
worksheet = workbook.add_sheet('new sheet')

# 创建样式对象
style = xlwt.XFStyle()

# 设置样式
font = xlwt.Font()
# 设置字体
font.name = '微软雅黑'
# 设置字体加粗
font.bold = True
# 设置斜体
font.italic = True
# 设置下划线
font.underline = True

# 设置样式
style.font = font

# 向单元格中写入内容
worksheet.write(0,0,'hello')
worksheet.write(2,1,'world',style)

workbook.save('test1.xls')
